const express = require('express')
const router = express.Router()
const columnValidator = require('../../validator/column')
const columnCtrl = require('../../controller/column')

// 获取所有专栏列表
router.get('/', columnCtrl.getColumns)

// 添加专栏
router.post('/', columnValidator.createColumn, columnCtrl.createColumn)

// 获取专栏内的所有文章
router.get('/:columnId', columnCtrl.getColumn)

// 更新专栏
router.put('/:columnId', columnCtrl.updateColumn)

router.delete('/:columnId/:articleId', columnCtrl.deleteColumnConnectArticle)

// 删除专栏
router.delete('/:columnId', columnCtrl.deleteColumn)

module.exports = router
